/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package miage.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Pepito
 */
@Entity
@Table(name = "facture")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Facture.findAll", query = "SELECT f FROM Facture f"),
    //@NamedQuery(name = "Facture.findAllByClient", query = "SELECT f FROM Facture f WHERE f.clientCommande = :clientCommande"),
    @NamedQuery(name = "Facture.findByDate", query = "SELECT f FROM Facture f WHERE f.date = :date"),
    @NamedQuery(name = "Facture.findByClientCommande", query = "SELECT f FROM Facture f WHERE f.clientCommande = :clientCommande"),
    @NamedQuery(name = "Facture.findByProduitCommande", query = "SELECT f FROM Facture f WHERE f.produitCommande = :produitCommande"),
    @NamedQuery(name = "Facture.findByQuantiteProduit", query = "SELECT f FROM Facture f WHERE f.quantiteProduit = :quantiteProduit"),
    @NamedQuery(name = "Facture.findByPrixProduit", query = "SELECT f FROM Facture f WHERE f.prixProduit = :prixProduit")})
public class Facture implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "client_commande")
    private String clientCommande;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "produit_commande")
    private String produitCommande;
    @Basic(optional = false)
    @NotNull
    @Column(name = "quantite_produit")
    private int quantiteProduit;
    @Basic(optional = false)
    @NotNull
    @Column(name = "prix_produit")
    private double prixProduit;

    public Facture() {
    }

    public Facture(Date date) {
        this.date = date;
    }

    public Facture(Date date, String clientCommande, String produitCommande, int quantiteProduit, double prixProduit) {
        this.date = date;
        this.clientCommande = clientCommande;
        this.produitCommande = produitCommande;
        this.quantiteProduit = quantiteProduit;
        this.prixProduit = prixProduit;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getClientCommande() {
        return clientCommande;
    }

    public void setClientCommande(String clientCommande) {
        this.clientCommande = clientCommande;
    }

    public String getProduitCommande() {
        return produitCommande;
    }

    public void setProduitCommande(String produitCommande) {
        this.produitCommande = produitCommande;
    }

    public int getQuantiteProduit() {
        return quantiteProduit;
    }

    public void setQuantiteProduit(int quantiteProduit) {
        this.quantiteProduit = quantiteProduit;
    }

    public double getPrixProduit() {
        return prixProduit;
    }

    public void setPrixProduit(double prixProduit) {
        this.prixProduit = prixProduit;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (date != null ? date.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Facture)) {
            return false;
        }
        Facture other = (Facture) object;
        if ((this.date == null && other.date != null) || (this.date != null && !this.date.equals(other.date))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "miage.entities.Facture[ date=" + date + " ]";
    }
    
}
